Protect __del__ from failure inside __init__ by setting inTransaction before
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Tue, 18 Oct 2005 17:07:11 +0000 (18:07 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Tue, 18 Oct 2005 17:07:11 +0000 (18:07 +0100)
trying to create a transaction instance.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/xenstore/xstransact.py

index d33b209e8e50dd715eaa2b79d8558176e6573ab9..ac8269f2bace6dc997a5ee14fa73e96fc4f7b249 100644 (file)
@@ -14,6 +14,9 @@ from xen.xend.xenstore.xsutil import xshandle
 class xstransact:
 
     def __init__(self, path):
+        self.in_transaction = False # Set this temporarily -- if this
+                                    # constructor fails, then we need to
+                                    # protect __del__.
         self.path = path.rstrip("/")
         self.transaction = xshandle().transaction_start()
         self.in_transaction = True